<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        #box{
            width: 500px;
            height: 500px;
            background: pink;
        }
        #box1{
            width: 300px;
            height: 300px;
            background:red;
        }
        #box2{
            width: 100px;
            height: 100px;
            background:gray;
        }
    </style>
</head>
<body>
    <div id="box">
        <div id="box1">
            <div id="box2"></div>
        </div>
    </div>
    <script>
        const box = document.getElementById('box')
        const box1 = document.getElementById('box1')
        const box2 = document.getElementById('box2')
        box.addEventListener('click',()=>{
            console.log('box触发')
        },false)
        box1.addEventListener('click',()=>{
            console.log('box1触发')
        },{
            useCapture:true
        })
        // box2.addEventListener('click',(e)=>{
        //     // e.stopPropagation()
        //     console.log('box2触发')
        // },false)
        box2.addEventListener('click',(e)=>{
            // e.cancelBubble = true
            console.log('box2触发')
        },{
            once:true,
            useCapture:true
        })
    </script>
</body>
</html>